package com.atguigu.gmall.activity.service;

import com.atguigu.gmall.common.result.ResultCodeEnum;
import com.atguigu.gmall.model.activity.SeckillGoods;
import com.atguigu.gmall.model.order.OrderInfo;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fasterxml.jackson.core.JsonProcessingException;

import java.util.List;

public interface SeckillService extends IService<SeckillGoods> {

    List<SeckillGoods> getCurrentSeckillGoods();

    /**
     * 生成秒杀码
     * @param skuId
     * @param userId
     * @return
     */
    String generateSeckillCode(Long skuId, String userId);

    Boolean checkSeckillCode(Long skuId,String userId,String code);

    List<SeckillGoods> getCurrentSeckillGoodsFromCache();


    SeckillGoods getSeckillGoodsById(Long skuId);

    boolean seckillStockLocked(Long skuId, String skuIdStr, String userId);

    boolean checkRepeat(Long skuId, String userId, String skuIdStr);

    ResultCodeEnum checkOrderStatus(Long skuId, String userId) throws JsonProcessingException;

    OrderInfo getUserSeckillOrderInfo(String userId) throws JsonProcessingException;

    public void clearBeforeDatas() throws JsonProcessingException;
}
